<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <!-- <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">-->
    <title></title>
<script type="text/javascript" src="/javascripts/jquery-1.11.2.min.js"></script>

<!--<link rel="stylesheet" href="./stylesheets/font-awesome-4.3.0/css/font-awesome.min.css">-->
<link rel="stylesheet" href="/javascripts/build/car.css">
<!--<link rel="stylesheet" href="/stylesheets/font/css/style.css">
<link rel="stylesheet" href="/stylesheets/ease/ease.css">


<link rel="stylesheet" href="/stylesheets/mystart.css">


<link rel="stylesheet" type="text/css" href='/stylesheets/login.css'/>-->

<!--<script src="/javascripts/src/libs.js"></script>-->
<!--<script src="/javascripts/build/car.min.js"></script>-->
<!--<script src="/javascripts/controllers.js"></script>-->
<!--<script src="/javascripts/orderControllers.js"></script>-->
<!--<script src="/javascripts/centerControllers.js"></script>-->
<!--<script src="/javascripts/services.js"></script>-->
<!--<script src="/javascripts/centerServices.js"></script>-->
<!--<script src="/javascripts/orderServices.js"></script>-->
<!--<script src="/javascripts/directive.js"></script>-->

<link rel="stylesheet" type="text/css" href="/stylesheets/date/DateTimePicker.css" />
<script type="text/javascript" async="async" src="/stylesheets/date/DateTimePicker.js"></script>
<script type="text/javascript" src="/javascripts/slider/jquery.slides.min.js"></script>
<!--<script type="text/javascript"  src="./bower_components/ng-file-upload/angular-file-upload-shim.min.js"></script>
<script type="text/javascript"  src="./bower_components/ng-file-upload/angular-file-upload.min.js"></script>-->
<link  href="/javascripts/cropper/css/cropper.css" rel="stylesheet">
<link  href="/javascripts/cropper/css/docs.css" rel="stylesheet">
<script src="/javascripts/cropper/js/cropper.js"></script>
<style>
    .bcmsg{
        position: fixed;z-index: 99;width:10em;left: 0;text-align:center;border-radius: 0.5em;right: 0;height: 2em;line-height: 2em;background-color:  rgba(51,51,51, 0.5); margin-left:auto;margin-right:auto;top: 40%;color: red
    }
</style>
</head>
<body>
<div class="content">
    <div class="img">
        <img src="../../image/bianfuxia.png" style="height: 8em">
    </div>
    <form method="post" action="<%=type%>" onsubmit="submitPhone()">
        <div class="input">
            <!--<img src="../../image/header.png">-->
            <span class="icon-icon-02 a1" style="color:#F74042;font-size: 2em; padding-left: 0.08em; padding-right: 0.55em;vertical-align: middle"></span>
            <input type="text" name="phone" placeholder="手机号码" class="inputtext" id="phone" required/>
            <input type="text" name="openid" value="<%=openid%>" style="display: none" class="inputtext" id="openid" required/>
            <input type="text" name="nickname" value="<%=nickname%>" style="display: none" class="inputtext" id="nickname" required/>
            <input type="text" name="newuser" value="<%=nickname%>" style="display: none" class="inputtext" id="newuser" required/>
            <input type="text" name="headimgurl" value="<%=headimgurl%>" style="display: none" class="inputtext" id="newuser" required/>
        </div>
        <div class="input" id="pwdShow" style="display: none">
        <!--<img src="../../image/password.png">-->
        <span class="icon-icon-03 a1" style="color:#F74042;font-size: 2em; padding-right: 0.5em;vertical-align: middle"></span>
        <input type="password" name="pwd" placeholder="密码，6-14位数字、字母" class="inputtext" id="pwd"  maxlength="14" minlength="6" required/>
        </div>
        <div class="input" style="padding-bottom: 0.5em">
            <!--<img src="../../image/phone.png">-->
            <span class="icon-icon-10 a1" style="color:#F74042;font-size: 1em;padding-bottom: 1em; padding-right: 0.8em;vertical-align: middle;line-height: 3em"></span>
            <input type="number"  placeholder="短信验证码" id="code" style="width: 30%;height: 2em;border: 0;" required/>
            <input type="button"  value="获取验证码"  onclick="getCode()" class="register" style="">
        </div>
        <div class="input" style="border: 0;"><span style="position: absolute;color: red;font-size: 0.9em;margin-top: 0.3em;" class="prompt"></span>
        </div>
        <div class="input" style="border:0;margin-top: 3em;margin-bottom: 1em;text-align: center;">
            <input type="submit" disabled="true" class="login inputtext" id="sub" value="提 交" style="background-color: #666666;"/>
        </div>

        <!--<div style="bottom: 0.5em;position: fixed;width: 100%;text-align: center;font-size: 0.8em;color: #4682B4">忘记密码&nbsp;|&nbsp;手机注册</div>-->
    </form>
</div>
    <!--<div ng-show="lmsg" class="bcmsg">{{loginMsg}}</div>-->
</body>
<script>
    code='';

    function getCode(){
        var phone=$('#phone').val();
        var partten = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
       if(phone==''||phone.length<11){
           var html='请输入正确手机号'
           $('.prompt').html(html);
       }else if(!partten.test(phone)){
           var html='请输入正确手机号'
           $('.prompt').html(html);
       }else{
           $.post('/index/getCode',{phone:phone},function(random){
               code=random;
           });
           var num=60;
           $('.register').val(num);
           if(timer)clearInterval(timer);
           var timer = setInterval(function(){
               num-=1;
               $('.register').val(num);
               if(num==0){
                   $('.register').val('  重新获取  ');
                   code='';
               }
           },1000);
       }
    }
    $('#code').bind('input propertychange', function() {
        var textCode = $("#code").val();
        var phone=$('#phone').val();
        if(textCode==code&&textCode!==''){
            $('.prompt').html('');
            $.post('/index/register',{phone:phone,openid:'<%=openid%>',nickname:'<%=nickname%>'},function(data){
                if(data=='isEmpty'){
                    $('#pwdShow').css('display','block');
                    $('#sub').removeAttr("disabled");
                    $('#sub').css('background-color','#F74042');
                    $('#newuser').val('no');
                }else if(data=='notEmpty') {
                    $('#pwd').val('notEmpty');
                    $('#sub').removeAttr("disabled");
                    $('#sub').css('background-color', '#F74042');
                    $('#newuser').val('no');
                }else if(data=='sameOpenid'){
                    $('.prompt').html('此手机号已被使用');
                }else{
                    $('#pwdShow').css('display','block');
                    $('#sub').removeAttr("disabled");
                    $('#sub').css('background-color','#F74042');
                    $('#newuser').val('yes');
                }
            });
        }else{
            $('.prompt').html('请正确填写验证码');
        }
    });
    function submitPhone(){
        var phone=$('#phone').val();
        var pwd=$('#pwd').val();
        var partten = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
        if(phone==''||phone.length<11){
            var html='请输入正确手机号'
            $('.prompt').html(html);
            return false;
        }else if(!partten.test(phone)){
            var html='请输入正确手机号'
            $('.prompt').html(html);
            return false;
        }else if(pwd==''||pwd==null) {
            var html = '请正确输入密码'
            $('.prompt').html(html);
            return false;
        }else if(pwd.length<6){
            var html = '密码不能小于6位'
            $('.prompt').html(html);
            return false;
        }else{
            $('.prompt').html('');
            return true;
        }
    }
</script>
</html>

